<template>
  <view class="container">
    <uni-data-picker
      v-model="selectedDate"
      type="date"
      :startDate="startDate"
      :endDate="endDate"
      @change="onDateChange"
    />
    <text>选中的日期: {{ selectedDate }}</text>
  </view>
</template>

<script>
export default {
  data() {
    return {
      selectedDate: '',
      startDate: '2020-01-01',  // 可选择的开始日期
      endDate: '2030-12-31'     // 可选择的结束日期
    };
  },
  methods: {
    onDateChange(date) {
      this.selectedDate = date;
      console.log('选择的日期:', date);
    }
  }
};
</script>

<style>
.container {
  padding: 20px;
}
</style>
